package com.one.group.admin.mapper;


import com.mybatisflex.core.BaseMapper;
import com.one.group.model.dto.RoleQueryDto;
import com.one.group.model.entity.Role;
import com.one.group.model.vo.RoleListVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * {@code @Create:}  2025-09-28  12 : 53
 * {@code @Author:} Cherry
 * {@code @ToUser:} 凡是发生,皆有利于我。
 * ------------------------------------
 * {@code @note:}
 */
public interface RoleMapper extends BaseMapper<Role> {


    /**
     * 角色列表查询
     * @param name 角色名称 tenantId 租户ID
     * @return
     */
    List<RoleListVo> findRoleByQueryDto(String  name,Long tenantId);

    /**
     * 根据管理员id查询对应角色
     * @param adminId
     * @return
     */
    @Select("SELECT r.id,r.name,r.description  FROM sp_admin_role ar," +
            "sp_role r WHERE ar.role_id = r.id  AND ar.admin_id =#{adminId}")
    List<Role> findRoleByAdminId(Long adminId);

    List<String> findPermissionByAdminId(Long adminId);
}
